package com.aierkeji.call.b2c.dao.jpa;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.aierkeji.call.b2c.dao.BaseJPADao;
import com.aierkeji.call.b2c.dao.jpa.custom.AkjCallUserDaoCustom;
import com.aierkeji.call.b2c.entity.AkjCallUser;
import com.aierkeji.call.b2c.entity.vo.SearchOptionsVo;

public interface AkjCallUserDao  extends BaseJPADao<AkjCallUser, String>,AkjCallUserDaoCustom{

	int countByAccountAndIsDelete(@Param("account")String account,@Param("isDelete")Boolean isDelete);
	
	List<AkjCallUser> findByIsDelete(@Param("isDelete")Boolean isDelete);
	
	AkjCallUser findByAccountAndIsDelete(@Param("account")String account,@Param("isDelete")Boolean isDelete);
	
	

	@Query("select new com.aierkeji.call.b2c.entity.vo.SearchOptionsVo(name,id) from AkjCallUser where (leaderId=:leaderId or (:leaderId is null and leaderId is not null)) and isDelete=0 order by name desc")
	List<SearchOptionsVo> findCanAssigneUser(@Param("leaderId")Long leaderId);
	
}
